﻿using Microsoft.Data.SqlClient;
using MQ.Core.Db.SqlServer;
using MySql.Data.MySqlClient;
using Npgsql;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Data;
using System.Data.SqlClient;

namespace MQ.Core.Db
{
    public class DbFactory
    {
        public DatabaseType GetDatabaseType(string dbType)
        {
            switch (dbType)
            {
                case "SqlServer":
                    return DatabaseType.SqlServer;
                case "MySql":
                    return DatabaseType.MySql;
                case "Oracle":
                    return DatabaseType.Oracle;
                case "PostgreSql":
                    return DatabaseType.PostgreSql;
                default:
                    return DatabaseType.SqlServer;
            }
        }

        public static IDbConnection SqlServer(string connectionString)
        {
            return new SqlConnection(connectionString);
        }

        public IDbConnection MySql(string connectionString)
        {
            return new MySqlConnection(connectionString);
        }

        public IDbConnection Oracle(string connectionString)
        {
            return new OracleConnection(connectionString);
        }

        public IDbConnection PostgreSql(string connectionString)
        {
            return new NpgsqlConnection(connectionString);
        }
        public IDbConnection GetConnection()
        {
            return null;
        }
        public IDbConnection GetConnection(DbType dbType)
        {
            return null;
        }
    }
}
